package leetcode.linkedlist;

import leetcode.linkedlist.common.LinkedListUtils;
import leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 * int val;
 * ListNode next;
 * ListNode() {}
 * ListNode(int val) { this.val = val; }
 * ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution234 {
    public boolean isPalindrome(ListNode head) {
        return LinkedListUtils.isPalindrome(head);
    }
}

public class leetcode234 {
    public static void main(String[] args) {
        Solution234 solution234 = new Solution234();
        int[] nums = {1, 2, 2, 1};
        int[] nums1 = {1, 2};
        System.out.println(solution234.isPalindrome(LinkedListUtils.generateLinkedListByArray(nums)));
        System.out.println(solution234.isPalindrome(LinkedListUtils.generateLinkedListByArray(nums1)));
    }
}
